import Message from "./Message.vue"
import Vue from "vue"

//返回构造函数
const MessageConstructor =Vue.extend(Message)

//
const serve = (message)=>{//传参//message
    let messageInstance = new MessageConstructor()//新建对象
    //找到挂载元素
    messageInstance.$mount(document.createElement('div'))

    document.body.appendChild(messageInstance.$el);
    //显示
    messageInstance.message=message//传值消息
    messageInstance.visible=true//显示出弹框
    Vue.nextTick(()=>{
        setTimeout(()=>{
            messageInstance.visible=false//默认隐藏
        },3000)
    })



}
export default serve